﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Quartz;

namespace SD.CoreLibrary.CronExpressionDescripter.Test
{
    [TestClass]
    public class CronDescription
    {

        //QuartzExpressionBuilder builder = new QuartzExpressionBuilder();
        //var occ = builder.CalcNextDates(reversedCronExpression, DateTime.Now, 50);

        [TestMethod]
        public void TestSimpleQuartzExpression()
        {
            CronExpression cronExpression = new CronExpression("0 0/1 * 1/1 * ? *");
            string description = cronExpression.Descrip().Description;
            Assert.AreEqual("Every minute", description, "Ok");
        }
        [TestMethod]
        public void TestRegenerateSimpleQuartzExpression()
        {
            string original = "0 0/1 * 1/1 * ? *";
            CronExpression cronExpression = new CronExpression("0 0/1 * 1/1 * ? *");
            string reversedCronExpression = cronExpression.Descrip(CronDescriptionTypeEnum.Full).CronExpression;
            Assert.AreEqual(reversedCronExpression, original, "Ok");
        }
        [TestMethod]
        public void TestSimpleCronExpression()
        {
            string description = CronExpressionDescriptor.GetDescription("0 0/1 * 1/1 * ? *");
            Assert.AreEqual("Every minute", description, "Ok");
        }
    }
}
